﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Discuz.Common;

namespace TestDiscuz
{
    public partial class arithmetic : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //子集操作
            ArrayList list = new ArrayList();
            for(int i=0;i<10;i++)
            {
                list.Add(i);
            }
            ArrayList sub = Arithmetic.ArrayListCopy.CopyBewteenTo(list, 3, 8);
            Response.Write(sub[0] + " " + sub[sub.Count - 1]+"<br/>");
            sub = Arithmetic.ArrayListCopy.CopyNotBetweenTo(list, 3, 8);
            Response.Write(sub[0] + " " + sub[sub.Count - 1] + "<br/>");
            // 统计次数
            Response.Write(Arithmetic.ArrayListCopy.GetSubStringCount("aa,b,aaaa", "aa")+"<br/>");
            //单目
            object o1 = Arithmetic.ComputeOne("100.1", "++");
            object o2 = Arithmetic.ComputeOne("0", "--");
            object o3 = Arithmetic.ComputeOne("false", "!");
            object o4 = Arithmetic.ComputeOne("true", "!");
            object o5 = Arithmetic.ComputeOne("noTruenoFalse", "++");
            Response.Write(o1 + " " + o2 + " " + o3 + " " + o4 + " " + o5+"<br/>");
            //双目 
            o1 = Arithmetic.ComputeTwo("true", "false", "+");
            o2 = Arithmetic.ComputeTwo("123", "234", "<");
            o3 = Arithmetic.ComputeTwo("true", "false", ">");
            o4 = Arithmetic.ComputeTwo("1.0", "1", "=");
            o5 = Arithmetic.ComputeTwo("1", "100", "+");
            object o6 = Arithmetic.ComputeTwo("4", "1", ">>");
            object o7 = Arithmetic.ComputeTwo("4", "1", "<<");
            Response.Write(o1 + " " + o2 + " " + o3 + " "
                + o4 + " " + o5 + " " + o6 + " " + o7 + "<br/>");
            //表达式计算
            o1 = Arithmetic.ComputeExpression("1+ (5<<2)");
            o2 = Arithmetic.ComputeExpression("a>>2", "a", "100");
            o3 = Arithmetic.ComputeExpression("a<<b", new string[] { "a", "b" }, new string[] {"2","2" });
            Response.Write(o1 + " " + o2 + " " + o3  + "<br/>");
        }
    }
}
